Updating qb-inventory
As of 3/25/2023, lj-inventory and qb-inventory are compatible, and the installation process for this script is identical apart from the line numbers of the code section to be edited.
Never make changes to ANY script without making a backup first, you never know what might happen!
Adding Inventory Images
We can start the modification for our inventory system by adding the images for our new items, for the default qb-inventory
resource we will simply navigate to our qb-inventory/html/images
directory and drag and drop the images contained in
our keymaster download package. Once this is completed, images will be available on next reset, and we can continue to the
next step which will modify how the metadata is displayed for our evidence bag items in the inventory screen.
Modifying Metadata Display In FormatItemInfo()
This same javascript is used by lj-inventory as well meaning this installation process is compataible, but if you use a third-party inventory you may need to reach out to the developer for more information on how to add custom item metadata!
In order to accomodate our new evidence bag types, and properly display their metadata in the inventory system such as the
tracking identification number and time/date of collection, we will need to modify the FormatItemInfo()
function contained
within our qb-inventory/html/js/app.js
file. This involves replacing the existing entry for the 'filled_evidence_bag
item
and inserting our new code. The easiest way to proceed is to simply use CTRL-F to search for filled_evidence_bag
to find
the line we want to start on. If you are using a recent version of qb-inventory, this will be Line 485 as of 3/25/2023, and at
Line 559 in the lj-inventory/html/js/app.js
file in lj-inventory.
Once we have found the line for the 'filled_evidence_bag'
item we want to cut out the code matching the else if
statement
being careful not to delete the next section of the code. Highlight the following code below and press delete:
} else if (itemData.name == "filled_evidence_bag") {
$(".item-info-title").html("<p>" + itemData.label + "</p>");
if (itemData.info.type == "casing") {
$(".item-info-description").html(
"<p><strong>Evidence material: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Type number: </strong><span>" +
itemData.info.ammotype +
"</span></p><p><strong>Caliber: </strong><span>" +
itemData.info.ammolabel +
"</span></p><p><strong>Serial Number: </strong><span>" +
itemData.info.serie +
"</span></p><p><strong>Crime scene: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "blood") {
$(".item-info-description").html(
"<p><strong>Evidence material: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Blood type: </strong><span>" +
itemData.info.bloodtype +
"</span></p><p><strong>DNA Code: </strong><span>" +
itemData.info.dnalabel +
"</span></p><p><strong>Crime scene: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "fingerprint") {
$(".item-info-description").html(
"<p><strong>Evidence material: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Fingerprint: </strong><span>" +
itemData.info.fingerprint +
"</span></p><p><strong>Crime Scene: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "dna") {
$(".item-info-description").html(
"<p><strong>Evidence material: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>DNA Code: </strong><span>" +
itemData.info.dnalabel +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
Once we have removed this code, we will want to replace it with the following updated code that will display the metadata of our new evidence bag types, please ensure that you are not altering any other code in this file or you will get a parsing error:
} else if (itemData.name == "filled_evidence_bag") {
$(".item-info-title").html("<p>" + itemData.label + "</p>");
if (itemData.info.type == "casing") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Collected: </strong><span>" +
itemData.info.street +
"</span></p><p><strong>Caliber: </strong><span>" +
itemData.info.ammolabel +
"</span></p><p><strong>Serial Number: </strong><span>" +
itemData.info.serie +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "blood") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Collected: </strong><span>" +
itemData.info.street +
"</span></p><p><strong>Blood Type: </strong><span>" +
itemData.info.bloodtype +
"</span></p><p><strong>DNA Code: </strong><span>" +
itemData.info.dnalabel +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "fingerprint") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"<p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Collected: </strong><span>" +
itemData.info.street +
"</span></p><p><strong>Fingerprint: </strong><span>" +
itemData.info.fingerprint +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "fragment") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Collected: </strong><span>" +
itemData.info.street +
"</span></p><p><strong>Vehicle: </strong><span>" +
itemData.info.vehname +
"</span></p><p><strong>Color: </strong><span>" +
itemData.info.vehcolor +
"</span></p><p><strong>VIN Match: </strong><span>" +
itemData.info.plate +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "gsr") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Conducted: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "bac") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>Result: </strong><span>" +
itemData.info.result +
"<p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Conducted: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "drugtest") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Conducted: </strong><span>" +
itemData.info.street +
"</span></p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking + "<br /><p>" +
itemData.info.result + "</p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "item") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Recovered: </strong><span>" +
itemData.info.street +
"</span></p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking + "<br /><p>" +
itemData.info.iteminfo + "</p><br /><p>" +
itemData.description +
"</p>"
);
} else if (itemData.info.type == "dna") {
$(".item-info-description").html(
"<p><strong>Type: </strong><span>" +
itemData.info.label +
"</span></p><strong>Tracking ID: </strong><span>" +
itemData.info.tracking +
"</span></p><p><strong>DNA Code: </strong><span>" +
itemData.info.dnalabel +
"<p><strong>Date: </strong><span>" +
itemData.info.date +
"</span></p><p><strong>Conducted: </strong><span>" +
itemData.info.street +
"</span></p><br /><p>" +
itemData.description +
"</p>"
);
}
This concludes the edits to qb-inventory, and we can now continue with our installation process. Please proceed to the qb-core installation portion of this guide!